package com.zl.credit.controller;


import com.zl.credit.entity.CreditCardMessage;
import com.zl.credit.service.CreditCardMessageService;
import com.zl.credit.service.impl.CreditCardMessageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author anonymous
 * @since 2020-07-14
 */
@RestController
@RequestMapping("/credit-card-message")
public class CreditCardMessageController {

    @Autowired
    private CreditCardMessageServiceImpl messageService;
    /**
     * 插入一条数据到卡片信息表
     * @param message
     */

    @RequestMapping(value = "/addmessage",method = RequestMethod.POST)
    public String addmessage(CreditCardMessage message){
        System.out.println("message = " + message);
        //银行卡主建生成
        message.setCardId("12314314314");
        boolean filg = messageService.save(message);
        return "index";
    }

    /**
     * 根据主键id查询卡片信息
     * @param cardid
     * @return
     */
    @RequestMapping(value = "QueryByid",method = RequestMethod.GET)
    public String QueryByid(String cardid){
        System.out.println("cardid = " + cardid);
        CreditCardMessage message = messageService.getById(cardid);
        System.out.println(message);
        return "index";
    }

}
